This function checks to see if a section exists in the currently open ini. This is not a necessary check to prevent errors as, when a section does not exist, reading from a non-existent section will just return a default value, however it can be useful to see if an ini file has saved specific data.
ini_section_exists(section);
| Argument | Description |
|---|---|
| section | The section in the open .ini file to check for. |
Boolean
ini_open("savedata.ini");
if !ini_section_exists("save1")
{
global.savegame = "1";
}
ini_close();
This will set variable global.savegame to "1" if "save1" is NOT found. With a for loop, this could be used as a basic way of working out how many save games there are for a game (ie: creating a system for multiple simultaneous save games for one game).